package com.linwen.javase.desgin_pattern.BigTalkDesignPattenJAVACode._17单例模式._7工具箱;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

//工具箱事件类
class ToolkitListener implements ActionListener {
    private JFrame toolkit;
    
    public void actionPerformed(ActionEvent e) {
        if (toolkit == null || !toolkit.isVisible()){

            toolkit = new JFrame("工具箱");
            
            toolkit.setSize(150,300);
            toolkit.setLocation(100,100);
            toolkit.setResizable(false);
            toolkit.setAlwaysOnTop(true); //置顶
            toolkit.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            toolkit.setVisible(true);
        }
    }
}
